<{include file="top.html"}>
</head>
<body>
<div class="xy-panel">
    <div class="xy-panel-top">
        <div class="xy-titlebar">
            <div class="xy-titlebar-left">
                <a class="insertBefore_left_arrow_gray" href="javascript:void(0);"></a>
            </div>
            <div class="xy-titlebar-title">信息填写</div>
            <div class="xy-titlebar-right"></div>
        </div>
    </div>
    <div class="xy-panel-content" style="bottom:0;padding:1rem 0;">
        <div class="xy-row vDirectionRow">
            <{if $deliverWay[1]}>
            <ul class="tab-topic">
                <li id="tab_to_1"><a class="tab_icon_1" href="javascript:void(0)" onClick="tab('tab',2,1)">自 提</a></li>
                <li id="tab_to_2"><a class="tab_icon_2" href="javascript:void(0)" class="color" onClick="tab('tab',2,2)">快 递</a></li>
            </ul>
            <{/if}>
            <form id="tab_mo_2" style="display:none;">
                <dl class="Annotate">注：快递寄送服务仅限<{$data.deliverArea}>地区</dl>
                <ul class="con_ui-list integrate_ui-list">
                    <li class="ui-list">
                        <i>姓名：</i>
                        <span><input type="text" name="realname" placeholder="请输入真实姓名" value="<{$userInfo['realName']}>"/></span>
                    </li>
                    <li class="ui-list">
                        <i>联系电话：</i>
                        <span><input type="tel" name="phone" placeholder="请输入联系电话" value="<{$userInfo['bindPhone']}>"/></span>
                    </li>
                </ul>
                <ul class="con_ui-list integrate_ui-list">
                    <li class="ui-list">
                        <i class="address-icon">详细地址：</i>
                    </li>
                    <li class="address_Newbox">
                        <i class="addressArea"><textarea name="address" placeholder="请输入详细地址"><{if $userInfo.address != "..."}><{$userInfo['address']}><{/if}></textarea></i>
                    </li>
                </ul>
                <ul class="con_ui-list address_ui-list">
                    <li class="ui-list">
                        <i class="pay-icon">支付信息：</i>
                    </li>
                    <li class="ui-list">
                        <i style="color:#333; text-align:left;">所需积分</i>
                        <i style="padding:0;">（拥有<{$userInfo['userPoint']}>积分）</i>
                        <span class="color"><{$data.point}>积分</span>
                    </li>
                    <li class="ui-list">
                        <i style="color:#333; text-align:left;">快递费用</i>
                        <span class="color"><{if $data.deliverPay > 0}><{$data.deliverPay}>元<{else}>包邮<{/if}></span>
                    </li>
                </ul>
                <input type="hidden" name="id" value="<{$data.id}>"/>
                <div class="ui-button ui-button-2">
                    <a href="javascript:void(0);" id="send-btn-2" onclick="submitInfo(2)">提交信息</a>
                </div>
            </form>

            <form id="tab_mo_1" style="display: none;">
                <ul class="con_ui-list integrate_ui-list">
                    <li class="ui-list">
                        <i>姓名：</i>
                        <span><input type="text" name="realname" placeholder="请输入真实姓名" value="<{$userInfo['realName']}>"/></span>
                    </li>
                    <li class="ui-list">
                        <i>联系电话：</i>
                        <span><input type="tel" name="phone" placeholder="请输入联系电话"  value="<{$userInfo['bindPhone']}>"/></span>
                    </li>
                </ul>
                <ul class="con_ui-list address_ui-list">
                    <li class="ui-list">
                        <i class="address-icon">提货地址：</i>
                    </li>
                    <li class="address_Newbox">
                        <i style="color:#333; text-align:left;"><{$data.pickAddress}></i>
                    </li>
                </ul>
                <ul class="con_ui-list address_ui-list">
                    <li class="ui-list">
                        <i class="pay-icon">支付信息：</i>
                    </li>
                    <li class="ui-list">
                        <i style="color:#333; text-align:left;">所需积分</i>
                        <i style="padding:0;">（拥有<{$userInfo['userPoint']}>积分）</i>
                        <span class="color"><{$data.point}>积分</span>
                    </li>
                </ul>
                <input type="hidden" name="address" value="<{$data.pickAddress}>"/>
                <input type="hidden" name="id" value="<{$data.id}>"/>
                <div class="ui-button ui-button-2">
                    <a href="javascript:void(0);" id="send-btn-1" onclick="submitInfo(1)">提交信息</a>
                </div>
            </form>

        </div>
    </div>
</div>
</body>
</html>
<{include file="signBody.html"}>
<script>
    $(document).ready(function(){
        var showBody = "<{$deliverWay[0]}>";
        const DELIVER_WAY_PICK =1;             //发货方式-自提
        const DELIVER_WAY_EXPRESS =2;          //发货方式-快递
        if(showBody == DELIVER_WAY_EXPRESS){
            $("#tab_mo_2").css('display','block');
            $("#tab_mo_1").css('display','none');
            document.getElementById("tab_to_2").className = "on";
        } else{
            $("#tab_mo_2").css('display','none');
            $("#tab_mo_1").css('display','block');
            document.getElementById("tab_to_1").className = "on";
        }
    });

    function tab(a,b,c)
    {
        for(i=1;i<=b;i++){
            if(c==i)
            {
// 判断选择模块
                document.getElementById(a+"_mo_"+i).style.display = "block";  // 显示模块内容
                document.getElementById(a+"_to_"+i).className = "on";   // 改变菜单为选中样式
            }
            else{
// 没有选择的模块
                document.getElementById(a+"_mo_"+i).style.display = "none"; // 隐藏没有选择的模块
                document.getElementById(a+"_to_"+i).className = "";  // 清空没有选择的菜单样式
            }
        }
    }
    function submitInfo(e){
        var param = $("#tab_mo_"+e).serialize();
        var selectWay = e;
        $.ajax({
            url:"<{U('PointMall/doExchange')}>",
            dataType:"json",
            data:param+"&selectWay="+selectWay,
            type:"POST",
            success:function(data){
                console.log(data);
                if (data.status==0) {
                    if(typeof data.orderStatus!='undefined' && data.orderStatus==3){
                        window.location.href=data.jumpUrl;
                    }else{
                        layer.msg(data.msg);
                        window.history.go(-1);
                    }
                }else{
                    layer.msg(data.msg);
                }
            },
            error:function(data){
                layer.msg('异常');
            }
        });
    }

</script>